let mongoose = require('mongoose'),
    resourcesPost = mongoose.model('resources_posts');

module.exports = (req, res, next) => {
    let params = req.body;

    if(!params.pid){
        res.json(resFail('pid不能为空'))
    }

    resourcesPost.update({
        pid: params.pid
    }, {
        $set: {
            recommend: params.recommend
        }
    }).exec(err => {
        if(err){
            res.json(resFail(err))
        }else{
            res.json({
                message: '推荐设置成功！',
                result: 1
            })
        }
    })
}